//
// Created by wkm on 2023-12-08.
//

#ifndef MYSYSTEMCLEARNING_READ_VECTORS_H
#define MYSYSTEMCLEARNING_READ_VECTORS_H

#include <iostream>
#include <fstream>
#include "systemc.h"
#include "../../ModelingExample/ShiftRegister/usr_define.h"

SC_MODULE(read_vectors) {
    sc_in<bool> read_clk;
    sc_out<sc_uint<SEL_WIDTH>> read_sel_op;
    sc_out<bool> read_clear, read_left_in, read_right_in;
    sc_out<sc_uint<WIDTH>> read_data_in, read_usr_out;

    void prc_read_vectors();

    ifstream infile;

    SC_CTOR(read_vectors) {
        SC_METHOD(prc_read_vectors);
        sensitive_neg << read_clk;
        infile.open("usr.in");

        if (!infile) {
            cerr << "****ERROR: Unable to open." << "vector file, usr.in" << endl;
            sc_stop(); //停止仿真
        }
    }
};


#endif //MYSYSTEMCLEARNING_READ_VECTORS_H
